package BanyuanClub.Study.Day0317;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;

public class CopyText {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("aaa.txt");
        FileChannel in = fis.getChannel();
        FileOutputStream fos = new FileOutputStream("aaa1.txt");
        FileChannel out = fos.getChannel();
        ByteBuffer buffer = ByteBuffer.allocate(100);
        int len;
        while((len=in.read(buffer))!=-1){
            buffer.flip();
            out.write(buffer);
            buffer.clear();
        }
    }
}
